{% extends 'base.html' %}
{% block content %}
<div class="right_col" role="main">
    <div class="">
        <div class="clearfix"></div>

        <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                    <div class="x_title">
                        <h2>{{ page_name }}<small>|&nbsp;<a href="{% url 'command_list' %}">远程命令管理</a></small></h2>
                        <ul class="nav navbar-right panel_toolbox">
                            <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                            </li>
                            <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                            <ul class="dropdown-menu" role="menu">
                                <li><a href="#">Settings 1</a>
                                </li>
                                <li><a href="#">Settings 2</a>
                                </li>
                            </ul>
                            </li>
                            <li><a class="close-link"><i class="fa fa-close"></i></a>
                            </li>
                        </ul>
                        <div class="clearfix"></div>
                    </div>
                    <div class="x_content">

                        <form onsubmit="return fileCheck();" class="form-horizontal form-border" method="post" action="" enctype="multipart/form-data">
                            {% csrf_token %}

                            {% for i in form %}
                            <div class="item form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12">{{ i.label_tag }} <span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    {{ i }}
                                    {{ i.errors }}
                                </div>
                            </div>
                            {% endfor %}
                            <div class="ln_solid"></div>
                            <div class="form-group">
                                <div class="col-md-6 col-md-offset-3">
                                    {% ifequal action 'add' %}
                                    <button id="send" type="submit" class="btn btn-success">添加</button>
                                    {% endifequal %}
                                    {% ifequal action 'edit' %}
                                    <button id="send" type="submit" class="btn btn-success">更新</button>
                                    {% endifequal %}
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}

{% block js %}
<!-- jQuery Tags Input -->
<script src="/static/js/jquery.tagsinput.js"></script>
<!-- jQuery Tags Input -->
<script>
    function onAddTag(tag) {
        alert("Added a tag: " + tag);
    }
function onRemoveTag(tag) {
    alert("Removed a tag: " + tag);
}
function onChangeTag(input, tag) {
    alert("Changed a tag: " + tag);
}
$(document).ready(function() {
        $('#tags_add').tagsInput({
width: 'auto'
});
        });
</script>
<!-- /jQuery Tags Input -->
{% endblock %}
